<template>
  <div>
    <el-button
      type="primary"
      icon="el-icon-search"
      size="small"
      @click="showDialog"
      >添加记录</el-button
    >
    <el-select
      v-model="form.value"
      clearable
      placeholder="请选择分类信息"
      size="small"
    >
      <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
      </el-option>
    </el-select>
    <el-input
      v-model="form.input"
      placeholder="请输入搜索信息"
      size="small"
    ></el-input>
    <span>学年：</span>
    <el-select
      v-model="form.schoolYear"
      clearable
      placeholder="请选择学年"
      size="small"
    >
      <el-option
        v-for="item in schoolYears"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
      </el-option>
    </el-select>
    <span>学期：</span>
    <el-select
      v-model="form.semester"
      clearable
      placeholder="请选择学年"
      size="small"
    >
      <el-option
        v-for="item in semesters"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
      </el-option>
    </el-select>
    <el-button icon="el-icon-search" circle @click="search"></el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      options: [
        {
          value: "studentName",
          label: "姓名",
        },
        {
          value: "studentNumber",
          label: "学号",
        },
        {
          value: "clazz",
          label: "班级",
        },
        {
          value: "grade",
          label: "年级",
        },
      ],
      schoolYears: [
        { value: "2017-2018年", label: "2017-2018年" },
        { value: "2018-2019年", label: "2018-2019年" },
        { value: "2019-2020年", label: "2019-2020年" },
        { value: "2020-2021年", label: "2020-2021年" },
        { value: "2021-2022年", label: "2021-2022年" },
        { value: "2022-2023年", label: "2021-2022年" },
      ],
      semesters: [
        { value: "1", label: "1" },
        { value: "2", label: "2" },
      ],
      form: {
        value: "",
        input: "",
        schoolYear: "",
        semester: "",
      },
    };
  },
  methods: {
    search() {
      console.log(this.form);
    },
    showDialog() {
      this.$emit("show");
    },
  },
};
</script>

<style lang="scss" scoped>
.el-button {
  margin-right: 10px;
}
.el-select {
  width: 150px;
  margin-right: 10px;
}
.el-input {
  width: 150px;
  margin-right: 10px;
}
</style>